<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAppealsTable extends Migration
{
    /**
     * Run the migrations.
     *诉求表
     * @return void
     */
    public function up()
    {
        Schema::create('appeals', function (Blueprint $table) {
            $table->id();
            $table->string("massname")->nullable()->comment('群众名称');
            $table->string('massphone')->nullable()->comment('群众电话');
            $table->foreignId('village_id')->nullable()->constrained()->onDelete('SET NULL')->comment("行政村ID");
            $table->string('category')->comment('诉求类别');
            $table->string('detail')->comment('诉求详情');
            $table->text('images')->nullable()->comment('上传图片');
            $table->boolean('state')->default(false)->comment('是否处理');
            $table->foreignId('wxuser_id')->nullable()->comment("发起人");
            //回复人：可能是user可能是wxuser
            $table->nullableMorphs("appealable");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('appeals');
    }
}
